package com.bridgeintelligent.tag.customer.service;

import com.bridgeintelligent.tag.customer.entity.CustomersPage;
import com.bridgeintelligent.tag.customer.entity.Result;
import com.bridgeintelligent.tag.customer.pojo.Customers;
import com.bridgeintelligent.tag.customer.pojo.CustomersApprovalRecord;
import com.bridgeintelligent.tag.customer.pojo.ExportSet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 客群审批服务层
 */

public interface ICustomerApprovalService {


    /**
     * 新增导出客群提交审批
     *
     * @param customerId
     */
    String  addCommit(String customerId,ExportSet exportSet);

    /**
     * 新增导出客群提交员工自助审批
     * @param exportSet
     */
    Result  addCCISCommit(ExportSet exportSet);

    /**
     * 导出客群审批通过
     *
     * @param customerId
     * @param instanceId
     * @param applicant
     */
    void addPass(String customerId,String instanceId,String applicant);

    /**
     * 导出客群审批驳回
     *
     * @param customerId
     */
    void reject(String customerId, String applicant,String instanceId, String desc);


    /* 获取审批列表
     *
     * @param pageNumber
     * @param pageSize
     * @param customerName
     * @param approveType
     * @param approveState
     * @param uptTimeStart
     * @param uptTimeEnd
     */
    CustomersPage<ExportSet> findList(Integer pageNumber, Integer pageSize, String customerName, String approveType, String approveState, String uptTimeStart, String uptTimeEnd);

    /**
     * 获取所有的申请类型
     */
    Map findApproveType();

    /**
     * 查询某个流程的当前审批状态
     * @param workflowId
     * @param customersId
     * @return
     */
    Customers findApprovalOne(String workflowId,String customersId);

    /**
     * 导出客群设置
     * @param exportSet
     */
    void addExportSet(ExportSet exportSet);

    /**
     * 查询某个人的导出设置信息
     * @return
     */
    void download(String id, HttpServletResponse response, HttpServletRequest request) ;

    /**
     * 向数据保险箱推送敏感数据
     * @return
     */
    Result pushFile(String id) ;

    /**
     * 查询导出设置实体
     * @param customerId
     * @pa
     * @return
     */
    ExportSet findCustomerSet(String customerId,String instanceId,String applicant);

    /**
     * 根据ID查询详情
     * @param id
     * @return
     */
    ExportSet findExportById(String id);

    /**
     * 刷新导出数据按钮
     * @param exportSet
     */
    void exportFlush(ExportSet exportSet);

    /**
     * 查询当前人某个客群的左右提交记录
     * @param paramSet
     * @return
     */
    boolean checkExportSet(ExportSet paramSet);

    /**
     * 校验 导出是否符合 要求
     * @param paramSet
     * @return
     */
    boolean checkExportSetting(ExportSet paramSet);

    CustomersPage<ExportSet> findRecordList(Integer pageNumber, Integer pageSize,
                                   String customerId,
            String customerName,
            String approveState,
            String exportName,
            String isready
    );

    /**
     * 导出重试
     * @param id
     * @return
     */
    boolean retry(String id);


    void test(String id,String isReady,String reason);

    /**
     * 修改数据文件的发送状态
     * @param id
     * @param sendStatus
     * @param zipName
     */
    void updateApply(String id,String sendStatus,String zipName);


    /**
     * 发布客群提交审批
     *
     * @param customersId
     */
    void releaseCommit(String customersId);

    /**
     * 发布客群审批通过
     *
     * @param customersId
     */
    void releasePass(String customersId,String instanceId);

    /**
     * 发布客群审批驳回
     *
     * @param customersId
     */
    void releasereject(String customersId, String instanceId, String desc);

    /**
     * 发布客群重新提交审批
     *
     * @param customersId
     */
    void releaseResubmit(String customersId);

    /* 获取发布客群的审批列表
     *
     * @param pageNumber
     * @param pageSize
     * @param customersName
     * @param approveType
     * @param approveState
     * @param uptTimeStart
     * @param uptTimeEnd
     */
    CustomersPage<Customers> findReleaseList(Integer pageNumber, Integer pageSize, String customersName, String approveType, String approveState, String uptTimeStart, String uptTimeEnd);

    /**
     * 删除客群提交审批
     *
     * @param customersId
     */
    void deleteCommit(String customersId);

    /**
     * 删除客群审批通过
     *
     * @param customersId
     */
    void deletePass(String customersId,String instanceId);

    /**
     * 删除客群审批驳回
     *
     * @param customersId
     */
    void deleteReject(String customersId, String instanceId, String desc);

    /**
     * 删除客群重新提交审批
     *
     * @param customersId
     */
    void deleteResubmit(String customersId);

    /**
     * 获取删除客群的审批列表
     *
     * @param pageNumber
     * @param pageSize
     * @param customersName
     * @param approveType
     * @param approveState
     * @param uptTimeStart
     * @param uptTimeEnd
     */
    CustomersPage<CustomersApprovalRecord> findDelRecordList(Integer pageNumber, Integer pageSize, String customersName, String approveType, String approveState, String uptTimeStart, String uptTimeEnd);

    /**
     * 查询某条删除审批数据的审批状态
     * @param customersId
     * @param workflowId
     * @return
     */
    String  findDelById(String customersId,String workflowId);

    List<String> findInstanceByPower(String workflowId);

    /**
     * CCIS的消息
     * @param message
     */
    void handleCCISMessage(String message);

}
